//
//  ItemEditViewController.h
//  iFlickr
//
//  Created by 张 霄鹤 on 09-6-6.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "UploadItem.h"
#import "UploadViewController.h"


@interface ItemEditViewController : UITableViewController<UITableViewDelegate,UITextFieldDelegate>{
	UploadItem *editItem;
	UIBarButtonItem *doneButton;
	UITableViewCell *titleCell;
	UITableViewCell *descriptCell;
	UITableViewCell *tagsCell;
	UITableViewCell *publicCell;
	UITableViewCell *friendCell;
	UITableViewCell *familyCell;
	
	UITextField *txtTitle;
	UITextField *txtDescription;
	UITextField *txtTags;
	
	UISwitch *sPublic;
	UISwitch *sFriend;
	UISwitch *sFamily;
	
	UploadViewController *uvc;
}

@property(nonatomic, retain) UploadItem *editItem;

@property(nonatomic, retain) UploadViewController *uvc;

@property(nonatomic, retain) IBOutlet UIBarButtonItem *doneButton;

@property(nonatomic, retain) IBOutlet UITableViewCell *titleCell;

@property(nonatomic, retain) IBOutlet UITableViewCell *descriptCell;

@property(nonatomic, retain) IBOutlet UITableViewCell *tagsCell;

@property(nonatomic, retain) IBOutlet UITableViewCell *publicCell;

@property(nonatomic, retain) IBOutlet UITableViewCell *friendCell;

@property(nonatomic, retain) IBOutlet UITableViewCell *familyCell;

@property(nonatomic, retain) IBOutlet UITextField *txtTitle;

@property(nonatomic, retain) IBOutlet UITextField *txtDescription;

@property(nonatomic, retain) IBOutlet UITextField *txtTags;

@property(nonatomic, retain) IBOutlet UISwitch *sPublic;

@property(nonatomic, retain) IBOutlet UISwitch *sFriend;

@property(nonatomic, retain) IBOutlet UISwitch *sFamily;

/**
 * 按钮事件，保存修改，直接操作 editItem 会将原始的item修改的
 */
-(IBAction)saveEditItem:(id)sender;

/**
 * switch点击，根据不同的点击进行权限的控制
 */
-(IBAction)clickSwitch:(id)sender;

// 因为在 UploadViewController 中已经提供了 Delete操作，因此不需要提供了，只有保存即可

/**
 * 获取前3个cell
 */
-(UITableViewCell *)getDescriptionCell:(NSInteger)row;

/**
 * 获取访问权限的3个 Cell
 */
-(UITableViewCell *)getAccessCell:(NSInteger)row;

#pragma mark -
#pragma mark UITextFieldDelegate Impl
/**
 * 点击Return key时候作的处理
 */
- (BOOL)textFieldShouldReturn:(UITextField *)textField;

@end
